
import { Cartesian3,Math,HeadingPitchRoll,Transforms } from 'cesium';
export const createModel = function(viewer,url,latlngheigt) {
    var position = Cartesian3.fromDegrees(latlngheigt.lng, latlngheigt.lat, latlngheigt.height);
    var heading = Math.toRadians(latlngheigt.heading||0);
    var pitch = Math.toRadians(latlngheigt.pitch||0);
    var roll = Math.toRadians(latlngheigt.roll||0);
    var hpr = new HeadingPitchRoll(heading, pitch, roll);
    var orientation = Transforms.headingPitchRollQuaternion(position, hpr);

    var entity = viewer.entities.add({
        name : url,
        position : position,
        orientation : orientation,
        model : {
            uri : url,
            // minimumPixelSize : 128,
            // maximumScale : 20000
        }
    });
    viewer.zoomTo(entity)
    // viewer.trackedEntity = entity;
}